home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / BARNET / FREENET / BRODIE / SOCK_ERR < prev   
Text File  |  1995-05-01  |  3KB  |  66 lines

  1. /*
  2.  * ArcWebTCP
  3.  *
  4.  * Copyright (C) Stewart Brodie, 1994, 1995
  5.  *
  6.  * This product is supplied under the terms laid down in the `Terms' file.
  7.  *
  8.  *
  9.  * This file: sock_errno.c
  10.  *
  11.  *  THIS WILL BE IN A SWI - IT CAN BE LINKED STATICALLY FOR THE MOMENT THOUGH
  12.  *
  13.  */
  14. #include <stdio.h>
  15. #include <errno.h>
  16. #include "sock_errno.h"
  17. #include "support.h"
  18.  
  19. char *socket_errno_to_string(void)
  20. {
  21.         static char ueb[64];
  22.  
  23.         switch (errno) {
  24.                 case 0: return "No error";
  25.                 default:
  26.                         sprintf(ueb,"Unknown error (%d)", errno);
  27.                         return ueb;
  28.  
  29. case EBADF                         : return "Bad descriptor";
  30. case EAGAIN                        : return "No more ports";
  31. case EFAULT                        : return "Bad address";
  32. case EINVAL                        : return "Invalid argument";
  33. case EWOULDBLOCK                   : return "Operation would block";
  34. case EINPROGRESS                   : return "Operation now in progress";
  35. case EALREADY                      : return "Operation already in progress";
  36. case ENOTSOCK                      : return "Socket operation on non-socket";
  37. case EDESTADDRREQ                  : return "Destination address required";
  38. case EMSGSIZE                      : return "Message too long";
  39. case EPROTOTYPE                    : return "Protocol wrong type for socket";
  40. case ENOPROTOOPT                   : return "Protocol not available";
  41. case EPROTONOSUPPORT               : return "Protocol not supported";
  42. case ESOCKTNOSUPPORT               : return "Socket type not supported";
  43. case EOPNOTSUPP                    : return "Operation not supported on socket";
  44. case EPFNOSUPPORT                  : return "Protocol family not supported";
  45. case EAFNOSUPPORT                  : return "Address family not supported by protocol family";
  46. case EADDRINUSE                    : return "Address already in use";
  47. case EADDRNOTAVAIL                 : return "Can't assign requested address";
  48. case ENETDOWN                      : return "Network is down";
  49. case ENETUNREACH                   : return "Network is unreachable";
  50. case ENETRESET                     : return "Network dropped connection on reset";
  51. case ECONNABORTED                  : return "Software caused connection abort";
  52. case ECONNRESET                    : return "Connection reset by peer";
  53. case ENOBUFS                       : return "No buffer space available";
  54. case EISCONN                       : return "Socket is already connected";
  55. case ENOTCONN                      : return "Socket is not connected";
  56. case ESHUTDOWN                     : return "Can't send after socket shutdown";
  57. case ETOOMANYREFS                  : return "Too many references: can't splice";
  58. case ETIMEDOUT                     : return "Connection timed out";
  59. case ECONNREFUSED                  : return "Connection refused";
  60. case EHOSTDOWN                     : return "Host is down";
  61. case EHOSTUNREACH                  : return "No route to host";
  62.  
  63.  
  64.         }
  65. }
  66.